import { MagicResourceType } from '../types';

// 镜像相关常量
export const MIRROR_FILE_CONSTANTS = {
    MIRROR_META_FILE: '.magic-api-mirror.json',
    META_FILE_EXTENSION: '.meta.json',
    SCRIPT_FILE_EXTENSION: '.ms',
    GROUP_META_FILE: '.group-meta.json',
    MERGE_DIR: '.merge',
    MAGIC_API_SCHEME: 'magic-api',
    FILE_SCHEME: 'file',
    META_SCRIPT_SEPARATOR: '================================',
} as const;

// 镜像相关类型定义

export interface MirrorMeta {
    createdAt: number;
    url?: string;
    token?: string;
    username?: string;
    password?: string;
    lspPort?: number;
    debugPort?: number;
    workbench?: {
        classes?: any[];
        extensions?: any[];
        functions?: any[];
        lastUpdated?: number;
    };
}

export interface MirrorFileMeta {
    id?: string;
    name: string;
    type: MagicResourceType;
    groupId?: string;
    groupPath: string;
    path?: string;
    method?: string;
    requestMapping?: string;
    description?: string;
    locked?: boolean;
    createTime?: number;
    updateTime?: number;
    localUpdateTime?: number;
    params?: any[];
    headers?: any;
    contentType?: string;
    timeout?: number;
    cron?: string;
    enabled?: boolean;
    executeOnStart?: boolean;
    extra?: Record<string, any>;
}